package it.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import it.service.HelloService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/demo")
public class HelloController {

    //远程服务接口调用
    //配置负载均衡
    @Reference(check = false, loadbalance = "random")
    private HelloService helloService;

    @RequestMapping("/hello")
    @ResponseBody
    public String sayHello(String name){
        System.out.println(name);
        return helloService.sayHello(name);
    }

}
